package com.justnow.offer;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

/**
 * @author justnow
 * Created on 2020-09-20
 * Description
 */
public class Duxiaoman01 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.nextLine();
        String T = scanner.nextLine();
        char[] chars = S.toCharArray();
        Map<Character, Integer> map = new HashMap<>();
        for (char aChar : chars) {
            if (map.containsKey(aChar)) {
                Integer number = map.get(aChar);
                map.put(aChar, number + 1);
            } else {
                map.put(aChar, 1);
            }
        }
        int count = 0;
        char[] array = T.toCharArray();
        for (char c : array) {
            if (map.containsKey(c) && map.get(c) >= 1) {
                count++;
                Integer integer = map.get(c);
                map.put(c, integer - 1);
            }
        }
        System.out.println(count);
    }
}
